package com.tanhua.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.tanhua.domain.Log;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

public interface LogMapper extends BaseMapper<Log> {
    @Select("select count(distinct user_id) from tb_log where type = #{type} and log_time = #{today}")
    Integer findNumRegistered(@Param("type") String type, @Param("today") String today);

    @Select("select count(distinct user_id) from tb_log where log_time=#{today}")
    Integer findActive(@Param("today") String today);

    @Select("select count(distinct user_id) from tb_log where type='0102' and log_time=#{yesterday} and user_id in" +
            "(select distinct user_id from tb_log where log_time=#{today})")
    Integer findNumRetention1d(@Param("yesterday") String yesterday, @Param("today") String today);

}

